package week6;

import java.util.Scanner;

public class PP0805 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num;
        int sum = 0, n = 0;
        double mean, sd, sdsum = 0;
        double[] numbers = new double[50];
        double[] numbers2 = new double[50];

        System.out.print("Enter the number(int): ");
        num = scan.nextInt();
        while (num != 0) {
            sum += num;
            numbers[n] += num;
            n++;
            System.out.print("Enter the number(int): ");
            num =scan.nextInt();
        }

        mean = (double)sum / n;
        for (int i = 0; i < n; i++) {
            sdsum += Math.pow(numbers[i] - mean, 2);
        }
        sd = Math.sqrt(sdsum);
        System.out.println("其平均值: " + mean + "\n其方差: " + sd);
    }
}
